package nine.test_9_21;

import java.util.Arrays;
import java.util.Scanner;

public class TestMain1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] hash = new int[10];
        int[][] arr = new int[4][10];
        int max = 0;
        for (int i = 0; i < n; i++) {
            int tmp1 = 0;
            int tmp2 = 0;
            for (int j = 0; j < 10; j++) {
                int count = scanner.nextInt();
                if(count != 0) {
                    tmp1++;
                }
                if(count == 2) {
                    tmp2++;
                }
                arr[i][j] = count;
            }
            if(tmp1 - 2 < tmp2 || tmp2 > 5) {
                arr[i][0] = -1;
            }
        }
        for (int i = 0; i< 4; i++) {
            for (int j = 0; j < 10; j++) {
                if(arr[i][j] == -1) {
                    break;
                }
                if (arr[i][j] == 2) {
                    hash[j]++;
                    max = Math.max(hash[j],max);
                }
            }
        }
        for (int i = 0; i < 10; i++) {
            if(hash[i] == max) {
                System.out.print(i + 1 + " ");
            }
        }
    }
}
